ShowTable of Contents
Introduction
This article describes a utility, which we developed, that can help you make a backup of your Notes.ini file whenever it changes, so that you would always have a copy of your previous snapshot of the Notes.ini, even after the file has been modified. This will help you understand what has changed in the Notes.ini at any given point.
Configuring the utility
There are three basic steps to configure the utility on an IBM® Lotus® and Domino®:
- Meeting the prerequisites
- Creating the batch file
- Scheduling the job on the Microsoft® Windows® platform
Prerequisites
The utility should be hosted only on Windows operating systems and, prior to configuring the utility, you should make a copy of the current Notes.ini file and save it as “Parentnotes.ini”. Also, note that the utility can be run on any versions of Lotus Notes and Domino.
Creating the batch file
The batch file watches for the Notes.ini file on every run, to determine whether the file has been modified, and compares the current Notes.ini file to the ParentNotes.ini file. To create the batch file:
1. Create a text document, copy the script in listing 1 into the text document, and name it “backupnotesiniutility.bat”.
NOTE: The only change you should make to this script is to replace the corresponding path of the Notes.ini file of your server, in the following line:
set notesinilog_dir="C:\Lotus852"
Listing 1. Batch file script
REM Setup file
set notesinilog_dir="C:\Lotus852"
cd %notesinilog_dir%
REM Add Current date and time to log
Echo. backupnotesiniutility.log
Echo------------------------------------------------------- backupnotesiniutility.log
Echo Notes.ini files comparison job started backupnotesiniutility.log
Echo Current date is; backupnotesiniutility.log
Date /t backupnotesiniutility.log
Echo Current Time is: backupnotesiniutility.log
Time /t backupnotesiniutility.log
:step1
fc notes.ini parentnotes.ini >temp1.log
@find /c /i "FC: no differences encountered" "temp1.log" > NUL
if %ERRORLEVEL% EQU 0 (
@GOTO Step2
) else (
@GOTO Step3
)
GOTO Step3
:Step2
Echo No Differences Encountered on this run at %date:~10,4%-%date:~7,2%-%date:~4,2% %time:~0,2%-%time:~3,2%-%time:~6,2% > backupnotesiniutility1.log
GOTO step1
:Step3
SET curdate=%date:~10,4%-%date:~7,2%-%date:~4,2%-%time:~0,2%-%time:~3,2%-%time:~6,2%
rename parentnotes.ini notesini-%curdate%.txt
copy notes.ini parentnotes.ini
Echo Notes.ini file comparison job has been completed backupnotesiniutility.log
Echo Current date is; backupnotesiniutility.log
Date /t backupnotesiniutility.log
Echo Current Time is: backupnotesiniutility.log
Time /t backupnotesiniutility.log
Echo Differences Encountered on this run, taken a copy of the notes.ini backupnotesiniutility.log
type temp1.log backupnotesiniutility.log
GOTO step1
Scheduling the utility to run as a job on Windows
To do this:
1. Select Start --- Run --- Tasks --- Add Scheduled Task.
2. Choose the location of the batch file, and click Next.
3. Enable the option “When my computer starts”, as shown in figure 1, and click Next.
Figure 1. Enable “When my computer starts”
4. In the next window, provide the OS user name and password details; click Next (see figure 2).
Figure 2. Provide user name and password
5. Click Finish, to set the utility to start every time that your computer starts (see figure 3).
Figure 3. Add task to your Windows schedule
6. If you want to stop the scheduled Windows job, right-click on the task, and select End Task (see figure 4).
Figure 4. Stopping the scheduled job manually
Tool architecture
As already mentioned, as a part of the configuration, we first provide a copy of the current Notes.ini file and save it as Parentnotes.ini. The tool then works by comparing the Notes.ini file with the Parentnotes.ini file, using the fc command to compare the two files.
Once it identifies a change, the tool renames the current Parentnotes.ini file and saves it as notesini-yyyy-MM-DD-HH-MM-SS.txt. It then makes a copy of current Notes.ini file and saves it as Parentnotes.ini, which is again used for comparison to identify the next changes on the next run of the utility.
Figure 5 shows a successful run of the utility, which has taken a backup of the Notes.ini after detecting that the file has changed.
Figure 5. Utility run
The tool has been designed to capture logs in the backupnotesiniutility.log file, which provides us with what action has been taken by the utility. If the Notes.ini file has not been modified, then backupnotesiniutility will not take any action, taking an exit signal. The relevant logs will be added to the backupnotesiniutility1.log file, which contains logs for the last run alone, and that should be latest time according to your OS.
A snapshot of the backupnotesiniutility1.log, for the instance when the utility didn't find any modification on the Notes.ini file, is shown in figure 6.
Figure 6. “No Differences Encountered....” message
Figure 7 is a snapshot of the backupnotesiniutility.log, when the utility finds a modification on the Notes.ini file.
Figure 7. “Differences Encountered ….” message
Running the Windows scheduled task in the background
While creating the scheduled task, if you run the task under the username “NT AUTHORITY\SYSTEM“, the job will run in the background (see figure 8).
Figure 8. User name for task to run in background
Conclusion
We have designed a tool to monitor the Notes/Domino Notes.ini file and, whenever there is a change in the file, to take a snapshot of it just before the change occurs. Each and every change is recorded/saved in an individual file (notesini-YYYY-DD-MM:HH:MIN.txt ), which helps track/monitor the changes.
Tell us what you think
Please visit this link to take a one-question survey about this article:
Resources
developerWorks Notes and Domino product page:
http://www.ibm.com/developerworks/lotus/products/notesdomino/
IBM Lotus Notes/Domino 8.5 Forum (includes Lotus Notes Traveler):
http://www-10.lotus.com/ldd/nd85forum.nsf?OpenDatabase
About the authors
Shankar Venkatachalam is a Software Engineer based at IBM's India Software Labs in Pune. He works on crash, core, and performance issues for Lotus Domino and more recently with the IBM SmartCloud® Notes L3/Development team. You can reach him at
svenkat7@in.ibm.com.
Ranjit S Rai is a Software Advisory Team Engineer and a member of APAC Software Advisory Team (APAC SWAT ) for the Lotus Domino. He has worked with IBM and Lotus products for more than 10 years. You can reach him at
ranjit.rai@in.ibm.com.